package com.societyGames.action
{
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;

	public class DelayAction extends Action
	{	
		private var _timer:Timer;
		
		public function DelayAction(milliseconds:Number)
		{
			this._timer = new Timer(milliseconds, 1);
		}
		
		public function timerHandler(event:Event):void
		{
			this._timer.removeEventListener(TimerEvent.TIMER, timerHandler);
			this._timer = null;
			this._completeEventObject.dispatchEvent();
		}
		
		public override function startAction():void
		{
			this._timer.start();
			this._timer.addEventListener(TimerEvent.TIMER, timerHandler);
		}
	}
}